{% extends 'home_page/base_index.html' %}
{% load static %}



{% block show_body %}
    {# 显示企业信息 #}
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header"><h4 class="card-title">{{ organization.name }} 企业信息</h4></div>
                <div class="card-content">
                    <div class="card-body">
                        <form class="form">
                            <div class="row">
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="first-name-column">名称</label><input
                                            type="text" id="first-name-column" class="form-control"
                                            placeholder="{{ organization.name }}"
                                            disabled="disabled"></div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="last-name-column">邮箱</label><input
                                            type="text" id="last-name-column" class="form-control" name="email"
                                            placeholder="{{ organization.email }}"
                                            disabled="disabled"></div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="city-column">介绍</label><input type="text"
                                                                                                        id="city-column"
                                                                                                        class="form-control"
                                                                                                        placeholder="{{ organization.description }}"
                                                                                                        disabled="disabled">
                                    </div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="country-floating">地址</label><input type="text"
                                                                                                             id="country-floating"
                                                                                                             class="form-control"
                                                                                                             disabled="disabled"
                                                                                                             placeholder="{{ organization.address }}">
                                    </div>
                                </div>
                                <div class="col-12 d-flex justify-content-end">
                                    创建时间：{{ organization.registration_date }}
                                </div>
                                <a id="subscribe" class="btn btn-success rounded-pill">关注</a>
                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}

{% block script_block %}
    <script>
        $("#subscribe").click(function () {
            $.ajax({
                url: "{% url 'student:subscribe' %}",
                type: "POST",
                data: {
                    "email": "{{ organization.email }}",
                    "csrfmiddlewaretoken": "{{ csrf_token }}"
                },
                success: function (data) {
                    alert(data.code);
                },
                error: function (data) {
                    alert(data.code);
                }
            })
        })
    </script>
{% endblock %}

